.class public Lcom/estrongs/android/pop/multicopy/a;
.super Ljava/lang/Object;
.source "CopyThread.java"

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field private a:Ljava/lang/String;

.field private b:J

.field private c:J

.field private d:Ljava/lang/String;

.field private e:I

.field private final f:Les/s80;
    .annotation build Landroidx/annotation/NonNull;
    .end annotation
.end field

.field private g:J

.field private h:Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;

.field private i:Z

.field private j:Landroid/os/ConditionVariable;


# direct methods
.method public constructor <init>(Les/s80;)V
    .locals 1
    .param p1    # Les/s80;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Landroid/os/ConditionVariable;

    invoke-direct {v0}, Landroid/os/ConditionVariable;-><init>()V

    iput-object v0, p0, Lcom/estrongs/android/pop/multicopy/a;->j:Landroid/os/ConditionVariable;

    .line 3
    iput-object p1, p0, Lcom/estrongs/android/pop/multicopy/a;->f:Les/s80;

    return-void
.end method

.method static synthetic a(Lcom/estrongs/android/pop/multicopy/a;)Landroid/os/ConditionVariable;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/android/pop/multicopy/a;->j:Landroid/os/ConditionVariable;

    return-object p0
.end method


# virtual methods
.method public a(I)V
    .locals 0

    .line 4
    iput p1, p0, Lcom/estrongs/android/pop/multicopy/a;->e:I

    return-void
.end method

.method public a(J)V
    .locals 0

    .line 2
    iput-wide p1, p0, Lcom/estrongs/android/pop/multicopy/a;->c:J

    return-void
.end method

.method public a(Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;)V
    .locals 0

    .line 5
    iput-object p1, p0, Lcom/estrongs/android/pop/multicopy/a;->h:Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;

    return-void
.end method

.method public a(Ljava/lang/String;)V
    .locals 0

    .line 3
    iput-object p1, p0, Lcom/estrongs/android/pop/multicopy/a;->d:Ljava/lang/String;

    return-void
.end method

.method public a()Z
    .locals 1

    .line 6
    iget-boolean v0, p0, Lcom/estrongs/android/pop/multicopy/a;->i:Z

    return v0
.end method

.method public b(J)V
    .locals 0

    .line 2
    iput-wide p1, p0, Lcom/estrongs/android/pop/multicopy/a;->g:J

    return-void
.end method

.method public b(Ljava/lang/String;)V
    .locals 0

    .line 1
    iput-object p1, p0, Lcom/estrongs/android/pop/multicopy/a;->a:Ljava/lang/String;

    return-void
.end method

.method public c(J)V
    .locals 0

    .line 1
    iput-wide p1, p0, Lcom/estrongs/android/pop/multicopy/a;->b:J

    return-void
.end method

.method public run()V
    .locals 16

    move-object/from16 v1, p0

    const/16 v0, 0xa

    .line 1
    invoke-static {v0}, Landroid/os/Process;->setThreadPriority(I)V

    .line 2
    iget-object v0, v1, Lcom/estrongs/android/pop/multicopy/a;->f:Les/s80;

    instance-of v2, v0, Les/d70;

    if-eqz v2, :cond_0

    .line 3
    new-instance v3, Lcom/estrongs/android/pop/multicopy/a$a;

    invoke-direct {v3, v1}, Lcom/estrongs/android/pop/multicopy/a$a;-><init>(Lcom/estrongs/android/pop/multicopy/a;)V

    invoke-virtual {v0, v3}, Les/s80;->a(Les/z80;)V

    .line 4
    :cond_0
    iget v0, v1, Lcom/estrongs/android/pop/multicopy/a;->e:I

    new-array v0, v0, [B

    const/4 v3, 0x0

    .line 5
    :try_start_0
    iget-object v4, v1, Lcom/estrongs/android/pop/multicopy/a;->h:Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;

    iget-wide v4, v4, Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;->totalWriteLen:J

    .line 6
    iget-object v6, v1, Lcom/estrongs/android/pop/multicopy/a;->a:Ljava/lang/String;

    invoke-static {v6}, Lcom/estrongs/android/util/h0;->s1(Ljava/lang/String;)Z

    move-result v6

    const-wide/16 v7, 0x1

    if-nez v6, :cond_2

    iget-object v6, v1, Lcom/estrongs/android/pop/multicopy/a;->a:Ljava/lang/String;

    invoke-static {v6}, Lcom/estrongs/android/util/h0;->D2(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_1

    goto :goto_0

    :cond_1
    move-object v6, v3

    goto :goto_2

    .line 7
    :cond_2
    :goto_0
    new-instance v6, Lcom/estrongs/android/util/TypedMap;

    invoke-direct {v6}, Lcom/estrongs/android/util/TypedMap;-><init>()V

    const-string v9, "end_offset"

    .line 8
    iget-object v10, v1, Lcom/estrongs/android/pop/multicopy/a;->a:Ljava/lang/String;

    invoke-static {v10}, Lcom/estrongs/android/util/h0;->D2(Ljava/lang/String;)Z

    move-result v10

    if-eqz v10, :cond_3

    iget-wide v10, v1, Lcom/estrongs/android/pop/multicopy/a;->c:J

    add-long/2addr v10, v7

    goto :goto_1

    :cond_3
    iget-wide v10, v1, Lcom/estrongs/android/pop/multicopy/a;->c:J

    :goto_1
    invoke-static {v10, v11}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v10

    invoke-virtual {v6, v9, v10}, Lcom/estrongs/android/util/TypedMap;->put(Ljava/lang/String;Ljava/lang/Object;)Lcom/estrongs/android/util/TypedMap;

    .line 9
    :goto_2
    invoke-static {}, Lcom/estrongs/fs/f;->d()Lcom/estrongs/fs/f;

    move-result-object v9

    iget-object v10, v1, Lcom/estrongs/android/pop/multicopy/a;->a:Ljava/lang/String;

    iget-wide v11, v1, Lcom/estrongs/android/pop/multicopy/a;->b:J

    add-long/2addr v11, v4

    invoke-virtual {v9, v10, v11, v12, v6}, Lcom/estrongs/fs/f;->a(Ljava/lang/String;JLcom/estrongs/android/util/TypedMap;)Ljava/io/InputStream;

    move-result-object v6
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    .line 10
    :try_start_1
    invoke-static {}, Lcom/estrongs/fs/f;->d()Lcom/estrongs/fs/f;

    move-result-object v9

    iget-object v10, v1, Lcom/estrongs/android/pop/multicopy/a;->d:Ljava/lang/String;

    iget-wide v11, v1, Lcom/estrongs/android/pop/multicopy/a;->b:J

    add-long/2addr v11, v4

    const/4 v13, 0x1

    invoke-virtual {v9, v10, v11, v12, v13}, Lcom/estrongs/fs/f;->a(Ljava/lang/String;JZ)Ljava/io/OutputStream;

    move-result-object v3

    .line 11
    :goto_3
    iget-wide v9, v1, Lcom/estrongs/android/pop/multicopy/a;->c:J

    iget-wide v11, v1, Lcom/estrongs/android/pop/multicopy/a;->b:J

    sub-long/2addr v9, v11

    add-long/2addr v9, v7

    cmp-long v11, v4, v9

    if-gez v11, :cond_8

    if-eqz v2, :cond_4

    .line 12
    iget-object v9, v1, Lcom/estrongs/android/pop/multicopy/a;->f:Les/s80;

    invoke-virtual {v9}, Les/s80;->m()I

    move-result v9

    const/4 v10, 0x3

    if-ne v9, v10, :cond_4

    .line 13
    iget-object v9, v1, Lcom/estrongs/android/pop/multicopy/a;->j:Landroid/os/ConditionVariable;

    invoke-virtual {v9}, Landroid/os/ConditionVariable;->block()V

    .line 14
    iget-object v9, v1, Lcom/estrongs/android/pop/multicopy/a;->j:Landroid/os/ConditionVariable;

    invoke-virtual {v9}, Landroid/os/ConditionVariable;->close()V

    .line 15
    :cond_4
    iget v9, v1, Lcom/estrongs/android/pop/multicopy/a;->e:I

    int-to-long v9, v9

    add-long/2addr v9, v4

    iget-wide v11, v1, Lcom/estrongs/android/pop/multicopy/a;->c:J

    iget-wide v14, v1, Lcom/estrongs/android/pop/multicopy/a;->b:J

    sub-long/2addr v11, v14

    add-long/2addr v11, v7

    const/4 v14, 0x0

    cmp-long v15, v9, v11

    if-lez v15, :cond_5

    .line 16
    iget-wide v9, v1, Lcom/estrongs/android/pop/multicopy/a;->c:J

    iget-wide v11, v1, Lcom/estrongs/android/pop/multicopy/a;->b:J

    sub-long/2addr v9, v11

    add-long/2addr v9, v7

    sub-long/2addr v9, v4

    long-to-int v10, v9

    invoke-virtual {v6, v0, v14, v10}, Ljava/io/InputStream;->read([BII)I

    move-result v9

    goto :goto_4

    .line 17
    :cond_5
    iget v9, v1, Lcom/estrongs/android/pop/multicopy/a;->e:I

    invoke-virtual {v6, v0, v14, v9}, Ljava/io/InputStream;->read([BII)I

    move-result v9

    :goto_4
    const/4 v10, -0x1

    if-ne v9, v10, :cond_6

    .line 18
    iget-wide v9, v1, Lcom/estrongs/android/pop/multicopy/a;->c:J

    iget-wide v11, v1, Lcom/estrongs/android/pop/multicopy/a;->b:J
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    sub-long/2addr v9, v11

    add-long/2addr v9, v7

    cmp-long v0, v4, v9

    if-gez v0, :cond_8

    .line 19
    :goto_5
    invoke-static {v3}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    .line 20
    invoke-static {v6}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    return-void

    .line 21
    :cond_6
    :try_start_2
    invoke-virtual {v3, v0, v14, v9}, Ljava/io/OutputStream;->write([BII)V

    int-to-long v9, v9

    add-long/2addr v4, v9

    .line 22
    iget-object v11, v1, Lcom/estrongs/android/pop/multicopy/a;->h:Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;

    iput-wide v4, v11, Lcom/estrongs/android/pop/multicopy/MultiThreadCopy$SegmentInfo;->totalWriteLen:J

    .line 23
    iget-object v11, v1, Lcom/estrongs/android/pop/multicopy/a;->f:Les/s80;

    const/4 v15, 0x2

    new-array v7, v15, [Ljava/lang/Object;

    iget-wide v12, v1, Lcom/estrongs/android/pop/multicopy/a;->g:J

    invoke-static {v12, v13}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v12

    aput-object v12, v7, v14

    invoke-static {v9, v10}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v12

    const/4 v8, 0x1

    aput-object v12, v7, v8

    const/16 v12, 0xe

    invoke-virtual {v11, v12, v7}, Les/s80;->b(I[Ljava/lang/Object;)V

    .line 24
    iget-object v7, v1, Lcom/estrongs/android/pop/multicopy/a;->f:Les/s80;

    new-array v11, v15, [Ljava/lang/Object;

    invoke-static {v9, v10}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v9

    aput-object v9, v11, v14

    iget-object v9, v1, Lcom/estrongs/android/pop/multicopy/a;->a:Ljava/lang/String;

    const/4 v8, 0x1

    aput-object v9, v11, v8

    invoke-virtual {v7, v15, v11}, Les/s80;->b(I[Ljava/lang/Object;)V

    .line 25
    iget-object v7, v1, Lcom/estrongs/android/pop/multicopy/a;->f:Les/s80;

    invoke-virtual {v7}, Les/s80;->z()Z

    move-result v7

    if-eqz v7, :cond_7

    goto :goto_5

    :cond_7
    const-wide/16 v7, 0x1

    const/4 v13, 0x1

    goto/16 :goto_3

    :cond_8
    const/4 v0, 0x1

    .line 26
    iput-boolean v0, v1, Lcom/estrongs/android/pop/multicopy/a;->i:Z
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_7

    :catchall_0
    move-exception v0

    goto :goto_6

    :catchall_1
    move-exception v0

    move-object v6, v3

    .line 27
    :goto_6
    invoke-static {v3}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    .line 28
    invoke-static {v6}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    .line 29
    throw v0

    :catch_0
    move-object v6, v3

    .line 30
    :catch_1
    :goto_7
    invoke-static {v3}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    .line 31
    invoke-static {v6}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    return-void
.end method
